#include <iostream>
#include <string>
#include <stack>
#include <unordered_map>

bool is_valid_bracket_a(const std::string& a) {
    std::unordered_map<char, char> bracket_mapping = {{']', '['}, {'}', '{'}, {')', '('}, {'>', '<'}};
    std::stack<char> bracket_stack;
    for (char bracket : a) {
        if (bracket_mapping.find(bracket) == bracket_mapping.end()) {
            bracket_stack.push(bracket);
        } else {
            if (bracket_stack.empty() || bracket_stack.top() != bracket_mapping[bracket]) {
                return false;
            }
            bracket_stack.pop();
        }
    }
    return bracket_stack.empty();
}

int main() {
    std::string input_a;
    std::cout << "Введите скобочную последовательность: ";
    std::cin >> input_a;
    std::cout << (is_valid_bracket_a(input_a) ? "True" : "False") << std::endl;
    return 0;
}
